package com.dlc.shop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.bean.model.ShopWallet;
import com.dlc.shop.bean.model.ShopWalletLog;
import com.dlc.shop.bean.param.CustomerReqParam;
import com.dlc.shop.common.util.PageParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商家钱包记录
 *
 * @author Dwl
 * @date 2019-09-19 14:02:57
 */
public interface ShopWalletLogMapper extends BaseMapper<ShopWalletLog> {


    /**
     * 计算商家从订单获取金额的数量
     *
     * @param orderNumber             订单编号
     * @param shopWalletChangeReason 钱包改变原因
     * @return 数量
     */
    int countInAmountByOrderNumber(@Param("orderNumber") String orderNumber, @Param("shopWalletChangeReason") Integer shopWalletChangeReason);

    /**
     * 根据订单号，由该订单号引起的分账信息
     * @param orderNumber 订单编号
     * @return 钱包日志列表
     */
    List<ShopWalletLog> listByOrderNumber(String orderNumber);


    /**
     * 计算商家从订单获取金额的数量
     *
     * @param orderNumber            订单编号
     * @param shopWalletChangeReason 钱包改变原因
     * @return 数量
     */
    int countInAmountByOrderId(@Param("orderNumber") String orderNumber, @Param("shopWalletChangeReason") Integer shopWalletChangeReason);


    /**
     * 计算商家从退款失去金额的数量
     *
     * @param refundSn               退款编号
     * @param shopWalletChangeReason 钱包改变原因
     * @return 数量
     */
    int countOutAmountByRefundSn(@Param("refundSn") String refundSn, @Param("shopWalletChangeReason") Integer shopWalletChangeReason);

    /**
     * 根据参数搜索钱包记录
     * @param page 分页参数
     * @param shopWalletLog 搜索参数
     * @return 钱包记录
     */
    IPage<ShopWalletLog> listByParam(@Param("page") PageParam<ShopWalletLog> page, @Param("shopWalletLog") ShopWalletLog shopWalletLog);

    /**
     * 查询所有店铺的日志
     * @param page 分页
     * @param shopWalletLog 查询参数
     * @return 所有店铺的日志
     */
    IPage<ShopWalletLog> pageAllByParam(@Param("page") PageParam<ShopWallet> page, @Param("shopWalletLog") ShopWalletLog shopWalletLog);

    /**
     * 获取店铺日志列表导出excel
     * @param customerReqParam
     * @return
     */
    List<ShopWalletLog> listShopWalletLogByParam(@Param("customerReqParam") CustomerReqParam customerReqParam);
}
